<?php
    session_start();
   	require_once 'config.php';
	require_once 'Date.php';

function checkUser($name)
    {
    global $DB, $table_prefix;

    $result=$DB->GetOne("select user_id from ${table_prefix}user where user_name=?",array($name));
    error_log(print_r($result, true));

    return ($result== NULL);
   }

	header("content-type: text/plain");
 if(checkUser($_GET["username"])) {

 	echo "available";
 }
 else {
 	echo "unavailable";
 }

?>
